package com.space.user.domain.account.service;

import com.space.user.domain.account.entity.UserAccount;
import com.space.user.domain.account.repository.UserAccountRepository;
import com.space.user.domain.account.valueobject.UserId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author <a href="mailto:414563035@qq.com">Bedroom</a>
 * @date 2021/4/26 3:58 下午
 */
@Service
public class UserAccountDomainService {
    @Autowired
    UserAccountRepository userAccountRepository;

    public void createAccountInfo(UserId userId) {
        userAccountRepository.save(UserAccount.builder().userId(userId).build());
    }

    public UserAccount getAccountInfo(UserId userId) {
        return userAccountRepository.find(userId);
    }
}
